package Hashing;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import Scanner.Scanner;

public class SongsFinger 
{
	public  static ArrayList<ShazamHash> makeFinger(File sample, int id ) throws IOException
	{
		ArrayList<ShazamHash> hashList = new ArrayList<>();
		
		Scanner scanner = new Scanner();
		Fingerprint fingerprint = new Fingerprint(id);
		
		double[] songsInfo = scanner.read(sample);
		double[] songsInfo4096 = new double[4096];
		for(int i = 0;i<songsInfo.length/4096;i++)
		{
			System.arraycopy(songsInfo, i*4096, songsInfo4096, 0, 4096);
			fingerprint.append(FFT.fft(songsInfo4096));
		}

		hashList = fingerprint.combineHash();
		return hashList;
	}
}
